03. Testing Lesson Map

L5 A02 Testing Lesson Map V2

Beginner Resources

Table of Contents

Lesson 2.1 Testing Basics

Part 1: Read and Write Basic Tests

  • Download the App - Download the Application (Code Checkpoint)
  • Default Test Setup - Explore the default testing setup for an Android Studio project
  • Run You First Test - Running and understanding test results in Android Studio
  • androidTest vs. Test - The difference between the androidTest and test folders (source sets); introduction to local and integration tests.
  • Write Your First Test - Write a simple test from start to finish
  • Make Your Tests Readable - Three strategies for readable tests

Part 2: Testing and Architecture

  • Planning a Testing Strategy - Unit, integration and end to end tests and how testing relates to architecture
  • App Tour - Tour of the app code

Part 3: Basic ViewModel and LiveData Tests

  • Setup a ViewModel Test - Create a ViewModel unit test for AndroidViewModel
  • AndroidX Test - An introduction to AndroidX Test
  • LiveData Testing Basics - How to test LiveData
  • Write Your Own ViewModel Test - Write a ViewModel test on your own

Lesson 2.2 Intro to Test Doubles and Dependency Injection

Part 4: Test Doubles and Dependency Injection

  • Test Doubles - An introduction to Test Doubles, including a Fake
  • Make a FakeDataSource - Create a Fake data source (Code Checkpoint)
  • Dependency Injection - An introduction to Dependency Injection
  • Test Repository with Constructor Dependency Injection and DI - Use constructor dependency injection to swap in your test double

Part 5: Test Doubles and Dependency Injection for ViewModel

  • Where else to Use Dependency Injection? - Answer questions to assess how to set up dependency injection
  • Set Up a Fake Repository - Create a fake repository
  • Use the Fake Repository inside a ViewModel - Use constructor dependency injection with ViewModels

Part 6: Writing ViewModel and Fragment Integration Tests

  • FragmentScenario - An introduction to FragmentScenario to create and control Fragments in tests
  • Launch a Fragment from a Test - Launch a fragment using FragmentScenario
  • Service Locators - What a Service Locator is, how to use it and how to create one
  • Use a Service Locator - Use a Service Locator in your main code
  • Use your Service Locator in your Tests - Use a Service Locator in your tests
  • Using Espresso to Test a Fragment - An introduction to the Espresso UI testing framework and finish writing your fragment view model integration test
  • Espresso Write Your Own Test - Practice writing your own fragment integration test with Espresso

Part 7: Mocking

  • Introduction to Mocks - An introduction to Mocks, when to use them instead of Fakes and Mocking with Mockito
  • Using Mockito to Write Navigation Tests - Write a test for the Navigation Component using Mockito

Lesson 2.3 Survey of Advanced Testing Topics

Part 8: Testing Coroutines

  • Testing Asynchronous Code - An introduction to the theory and challenges of testing asynchronous code on Android
  • Review of Testing Coroutines - Review of coroutines testing strategies covered up to this point
  • viewModelScope and TestCoroutineDispatcher - Test coroutines in a ViewModel and using TestCorotuineDispatcher (Code Checkpoint)
  • MainCoroutineRule and Injecting Dispatchers - Use best practices and strategies for removing boilerplate when testing coroutines
  • StatisticsViewModelTest - Setup StatisticsViewModel for testing
  • Testing Coroutine Timing - Write a test where you pause and resume coroutine execution to test a loading indicator

Part 9: Error Handling

  • Testing Error Handling - Write a test that makes sure errors are handled correctly

Part 10: Testing your Data Layer

  • Testing Room - Write a tests for a Room DAO
  • Testing Local Data Source - Write tests for a local data source

Part 11: Testing Databinding

  • Idling Resources and End-to-End Testing - Introduces EspressoIdlingResources and when you use them
  • Counting Idling Resource - Setup your first end to end test. Setup your application code to use CountingIldingResource so Espresso can test code that involves long running operation (like network calls)
  • Databinding Idling Resource - Setup an Espresso test for code that uses the DataBinding library
  • Using Idling Resources - Write tests that use EspressoIdlingResource

Part 12: Testing Global Navigation

  • Testing Global App Navigation - Write End to End tests that include Global App Navigation (Code Checkpoint)